// import { validate } from '../../api/login';
import { BaseResponse, LoginData } from '../../api/types';
import { push } from 'connected-react-router';
import * as types from '../action-types';
import {removeLogoutMsgFromSessionStore } from '../../utils/helpers';
/**
 * 登录和注册页切换
 * @param payload 
 */
export const changeTransform = (payload: boolean) => {
    return { type: types.CHANGE_TRANSFORM, payload }
}

/**
 * 登录成功
 * @param payload 
 */
export const successLogin = (payload: LoginData) => {
    return { type: types.SUCCESS_LOGIN, payload }
}

/**
 * 退出登录
 */
export const logout = () => {
    removeLogoutMsgFromSessionStore();
    return { type: types.LOGOUT };
}


/**
 *通过派发的方式跳转路径
 * @param path 
 */
export const go = (path: string) => {
    return push(path);
}


